Import("env")

env.Library(
    target='kv_engine_core',
    source=[
        'kv_catalog.cpp',
        'kv_collection_catalog_entry.cpp',
        ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/concurrency/lock_manager',
        '$BUILD_DIR/mongo/db/index/index_descriptor',
        '$BUILD_DIR/mongo/db/namespace_string',
        '$BUILD_DIR/mongo/db/storage/bson_collection_catalog_entry',
        ],
    LIBDEPS_TAGS=[
        # Depends on KVDatabaseCatalogEntry::getIndex, which does not have
        # a unique definition.
        'incomplete',
    ],
    )

# Should not be referenced outside this SConscript file.
env.Library(
    target='kv_database_catalog_entry_core',
    source=['kv_database_catalog_entry.cpp'],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/db/storage/bson_collection_catalog_entry',
        '$BUILD_DIR/mongo/db/storage/kv/kv_engine_core',
    ],
    LIBDEPS_TAGS=[
        # Depends on KVDatabaseCatalogEntry::getIndex, which is not uniquely defined
        'incomplete',
    ],
)

# Should not be referenced outside this SConscript file.
env.Library(
    target='kv_storage_engine',
    source=['kv_storage_engine.cpp'],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
        '$BUILD_DIR/mongo/db/storage/kv/kv_engine_core',
        '$BUILD_DIR/mongo/db/storage/storage_options',
        'kv_database_catalog_entry_core',
    ],
)

# KVDatabaseCatalogEntry::getIndex() depends on index access methods
# in $BUILD_DIR/mongo/serveronly.
env.Library(
    target='kv_engine',
    source=[
        'kv_database_catalog_entry_get_index.cpp',
        ],
    LIBDEPS=[
        'kv_database_catalog_entry_core',
        'kv_engine_core',
        'kv_storage_engine',
        ],
    LIBDEPS_TAGS=[
        # Depends on symbols from serverOnlyFiles
        'incomplete',
        ],
    )

# Stubs out KVDatabaseCatalogEntry::getIndex() for testing.
# Should not be referenced outside this SConscript file.
env.Library(
    target='kv_engine_mock',
    source=[
        'kv_database_catalog_entry_get_index_mock.cpp'
        ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/storage/storage_options',
        'kv_database_catalog_entry_core',
        'kv_engine_core',
        'kv_storage_engine',
        ]
    )

env.Library(
    target='kv_engine_test_harness',
    source=[
        'kv_engine_test_harness.cpp',
        'kv_engine_test_snapshots.cpp',
        ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/db/service_context',
        '$BUILD_DIR/mongo/unittest/unittest',
        'kv_engine_core',
        ],
    LIBDEPS_TAGS=[
        # Depends on KVHarnessHelper::create which does not have a unique definition
        'incomplete',
    ],

    )

env.CppUnitTest(
    target='kv_database_catalog_entry_test',
    source=[
        'kv_database_catalog_entry_test.cpp',
        ],
    LIBDEPS=[
        'kv_engine_mock',
        '$BUILD_DIR/mongo/db/namespace_string',
        '$BUILD_DIR/mongo/db/catalog/collection_options',
        '$BUILD_DIR/mongo/db/storage/devnull/storage_devnull_core',
        '$BUILD_DIR/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store',
        ]
    )
